<?php
define("MAIL_PATH", str_ireplace('\\', '/', dirname(__FILE__)));
error_reporting(E_STRICT);
date_default_timezone_set('Etc/GMT-8');
require_once (MAIL_PATH . '/class.phpmailer.php');
class SendMail
{
    function __construct ()
    {
        $this->mail = new PHPMailer();
        $this->mail->CharSet = "utf-8";
        $this->mail->IsSMTP(); // telling the class to use SMTP
        $this->mail->Host = 'smtp.163.com'; // send SMTP server
        $this->mail->SMTPDebug = 1; // enables SMTP debug information (for testing) // 2 = messages only
        $this->mail->SMTPAuth = true; // enable SMTP authentication
        $this->mail->Port = 25; // set the SMTP port for the GMAIL server
        $this->mail->Username = 'ozkc001@163.com'; // SMTP account username
        $this->mail->Password = 'snowdeng001'; // SMTP account password
        $this->mail->SetFrom('ozkc001@163.com', '欧洲快车客户服务');
        $this->mail->AddReplyTo('ozkc001@163.com', '欧洲快车客户服务');
    }
    function setParameAndSend ($subjectContent, $bodyContent, $addresses, 
    $attachments = null)
    {
        if (is_array($addresses)) {
            foreach ($addresses as $key => $address) {
                $this->mail->AddAddress($address, $key);
            }
        } else {
            $this->mail->AddAddress($addresses, $addresses);
        }
        $this->mail->Subject = $subjectContent;
        $this->mail->MsgHTML($bodyContent);
        if (! $this->mail->Send()) {
            return false;
        } else {
            return true;
        }
    }
}
?>
